<template>
  <h1>使用vuex </h1>

  <button @click="add">+1</button>{{  $store.state.add }}
  <hr />
  <button @click="sub">-1</button>{{ $store.state.reduce }}

</template>

<script setup>
import { reactive, ref } from "vue";
import { useStore } from 'vuex'
const store = useStore()

let num = ref(0);
let num2 = ref(100);

function add() {
  store.commit('increase');
}

function sub() {
  store.commit('decrease');
}
</script>

<style>
</style>